package pers.cj.pdos.controller.init;

import pers.cj.pdos.entity.Permission;
import pers.cj.pdos.service.IPermissionService;
import pers.cj.pdos.utils.UuidUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class InitPermission {
    public void init(IPermissionService permissionService) {
        //权限
        if (permissionService.count() > 0) {
            return;
        }

        List<Permission> list = new ArrayList<>();

        //销售订单
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","saleOrder:query",new Date(),"saleOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","saleOrder:insert",new Date(),"saleOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "关闭","saleOrder:close",new Date(),"saleOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","saleOrder:export",new Date(),"saleOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","saleOrder:print",new Date(),"saleOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "审核","saleOrder:verify",new Date(),"saleOrder"));

        //销售
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","sale:query",new Date(),"sale"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","sale:insert",new Date(),"sale"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","sale:close",new Date(),"sale"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","sale:export",new Date(),"sale"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","sale:print",new Date(),"sale"));

        //销售退货
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","refund:query",new Date(),"refund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","refund:insert",new Date(),"refund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","refund:close",new Date(),"refund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","refund:export",new Date(),"refund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","refund:print",new Date(),"refund"));

        //零售收银
        list.add(new Permission(UuidUtils.getUUID(),
                "开单","retail:order",new Date(),"retail"));

        //进货订单
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","inGoodsOrder:query",new Date(),"inGoodsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","inGoodsOrder:insert",new Date(),"inGoodsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","inGoodsOrder:close",new Date(),"inGoodsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","inGoodsOrder:export",new Date(),"inGoodsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","inGoodsOrder:print",new Date(),"inGoodsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "审核","inGoodsOrder:verify",new Date(),"inGoodsOrder"));

        //进货
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","inGoods:query",new Date(),"inGoods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","inGoods:insert",new Date(),"inGoods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","inGoods:close",new Date(),"inGoods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","inGoods:export",new Date(),"inGoods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","inGoods:print",new Date(),"inGoods"));

        //进货退货
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","inGoodsRefund:query",new Date(),"inGoodsRefund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","inGoodsRefund:insert",new Date(),"inGoodsRefund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","inGoodsRefund:close",new Date(),"inGoodsRefund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","inGoodsRefund:export",new Date(),"inGoodsRefund"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","inGoodsRefund:print",new Date(),"inGoodsRefund"));

        //库存盘点
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","checkHouse:query",new Date(),"checkHouse"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","checkHouse:insert",new Date(),"checkHouse"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","checkHouse:close",new Date(),"checkHouse"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","checkHouse:export",new Date(),"checkHouse"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","checkHouse:print",new Date(),"checkHouse"));

        //组装拆卸
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","joinSplit:query",new Date(),"joinSplit"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","joinSplit:insert",new Date(),"joinSplit"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","joinSplit:close",new Date(),"joinSplit"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","joinSplit:export",new Date(),"joinSplit"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","joinSplit:print",new Date(),"joinSplit"));

        //调拨
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","goodsTransfer:query",new Date(),"goodsTransfer"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","goodsTransfer:insert",new Date(),"goodsTransfer"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","goodsTransfer:close",new Date(),"goodsTransfer"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","goodsTransfer:export",new Date(),"goodsTransfer"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","goodsTransfer:print",new Date(),"goodsTransfer"));

        //借入
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","borrowIn:query",new Date(),"borrowIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","borrowIn:insert",new Date(),"borrowIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","borrowIn:close",new Date(),"borrowIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","borrowIn:export",new Date(),"borrowIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","borrowIn:print",new Date(),"borrowIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "归还","borrowIn:return",new Date(),"borrowIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "转进货","borrowIn:transferIn",new Date(),"borrowIn"));

        //借出
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","borrowOut:query",new Date(),"borrowOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","borrowOut:insert",new Date(),"borrowOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","borrowOut:close",new Date(),"borrowOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","borrowOut:export",new Date(),"borrowOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","borrowOut:print",new Date(),"borrowOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "归还","borrowOut:return",new Date(),"borrowOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "转销售","borrowOut:transferSale",new Date(),"borrowOut"));

        //入库管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","houseIn:query",new Date(),"houseIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "入库操作","houseIn:houseIn",new Date(),"houseIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","houseIn:close",new Date(),"houseIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","houseIn:export",new Date(),"houseIn"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","houseIn:print",new Date(),"houseIn"));

        //出库管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","houseOut:query",new Date(),"houseOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "出库操作","houseOut:houseOut",new Date(),"houseOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","houseOut:close",new Date(),"houseOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","houseOut:export",new Date(),"houseOut"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","houseOut:print",new Date(),"houseOut"));

        //库存查询
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","houseQuery:query",new Date(),"houseQuery"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","houseQuery:export",new Date(),"houseQuery"));
        list.add(new Permission(UuidUtils.getUUID(),
                "库存流水","houseQuery:water",new Date(),"houseQuery"));

        //序列号查询
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","goodsSn:query",new Date(),"goodsSn"));

        //日常收支
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","budget:query",new Date(),"budget"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","budget:insert",new Date(),"budget"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","budget:close",new Date(),"budget"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","budget:export",new Date(),"budget"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","budget:print",new Date(),"budget"));

        //收支项目管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","budgetProject:query",new Date(),"budgetProject"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","budgetProject:insert",new Date(),"budgetProject"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","budgetProject:delete",new Date(),"budgetProject"));

        //应收欠款
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","arrearsOrder:query",new Date(),"arrearsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "收款","arrearsOrder:receipt",new Date(),"arrearsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","arrearsOrder:close",new Date(),"arrearsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","arrearsOrder:export",new Date(),"arrearsOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","arrearsOrder:print",new Date(),"arrearsOrder"));

        //应付欠款
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","payOrder:query",new Date(),"payOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "付款","payOrder:pay",new Date(),"payOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","payOrder:close",new Date(),"payOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","payOrder:export",new Date(),"payOrder"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","payOrder:print",new Date(),"payOrder"));

        //资金流水
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","moneyWater:query",new Date(),"moneyWater"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","moneyWater:export",new Date(),"moneyWater"));

        //销售开票
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","saleTicket:query",new Date(),"saleTicket"));
        list.add(new Permission(UuidUtils.getUUID(),
                "开票","saleTicket:ticket",new Date(),"saleTicket"));

        //账户转账
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","transfer:query",new Date(),"transfer"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","transfer:insert",new Date(),"transfer"));
        list.add(new Permission(UuidUtils.getUUID(),
                "作废","transfer:close",new Date(),"transfer"));

        //客户管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","custom:query",new Date(),"custom"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","custom:insert",new Date(),"custom"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","custom:close",new Date(),"custom"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","custom:export",new Date(),"custom"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导入","custom:import",new Date(),"custom"));

        //客户分类
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","customType:query",new Date(),"customType"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","customType:insert",new Date(),"customType"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","customType:close",new Date(),"customType"));

        //供应商管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","provider:query",new Date(),"provider"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","provider:insert",new Date(),"provider"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","provider:close",new Date(),"provider"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","provider:export",new Date(),"provider"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导入","provider:import",new Date(),"provider"));

        //供应商分类
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","providerType:query",new Date(),"providerType"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","providerType:insert",new Date(),"providerType"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","providerType:close",new Date(),"providerType"));

        //销售报表-分析
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","saleAnalysis:query",new Date(),"saleAnalysis"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","saleAnalysis:export",new Date(),"saleAnalysis"));
        //销售退货报表-分析
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","refundAnalysis:query",new Date(),"refundAnalysis"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","refundAnalysis:export",new Date(),"refundAnalysis"));

        //进货报表-分析
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","inGoodsAnalysis:query",new Date(),"inGoodsAnalysis"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","inGoodsAnalysis:export",new Date(),"inGoodsAnalysis"));
        //进货退货报表-分析
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","inGoodsRefundAnalysis:query",new Date(),"inGoodsRefundAnalysis"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","inGoodsRefundAnalysis:export",new Date(),"inGoodsRefundAnalysis"));

        //经营状况报告
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","operateAnalysis:query",new Date(),"operateAnalysis"));

        //利润报表
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","profitAnalysis:query",new Date(),"profitAnalysis"));

        //业绩报表
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","performanceAnalysis:query",new Date(),"performanceAnalysis"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","performanceAnalysis:export",new Date(),"performanceAnalysis"));

        //商品套餐
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","packet:query",new Date(),"packet"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","packet:insert",new Date(),"packet"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","packet:delete",new Date(),"packet"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","packet:print",new Date(),"packet"));

        //商品模板
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","goodsTemplate:query",new Date(),"goodsTemplate"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","goodsTemplate:insert",new Date(),"goodsTemplate"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","goodsTemplate:delete",new Date(),"goodsTemplate"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","goodsTemplate:print",new Date(),"goodsTemplate"));

        //商品资料
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","goods:query",new Date(),"goods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","goods:insert",new Date(),"goods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","goods:delete",new Date(),"goods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导入","goods:import",new Date(),"goods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "导出","goods:export",new Date(),"goods"));
        list.add(new Permission(UuidUtils.getUUID(),
                "打印","goods:print",new Date(),"goods"));

        //商品分类
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","type:query",new Date(),"type"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","type:insert",new Date(),"type"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","type:delete",new Date(),"type"));

        //属性设置
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","attr:query",new Date(),"attr"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","attr:insert",new Date(),"attr"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","attr:delete",new Date(),"attr"));

        //单位设置
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","unit:query",new Date(),"unit"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","unit:insert",new Date(),"unit"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","unit:delete",new Date(),"unit"));

        //结算账户
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","settAccount:query",new Date(),"settAccount"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","settAccount:insert",new Date(),"settAccount"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","settAccount:delete",new Date(),"settAccount"));

        //门店
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","store:query",new Date(),"store"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","store:insert",new Date(),"store"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","store:delete",new Date(),"store"));
        //仓库
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","house:query",new Date(),"house"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","house:insert",new Date(),"house"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","house:delete",new Date(),"house"));

        //业务设置
        list.add(new Permission(UuidUtils.getUUID(),
                "修改","businessSet:insert",new Date(),"businessSet"));

        //零售收银设置
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","retailSet:query",new Date(),"retailSet"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","retailSet:insert",new Date(),"retailSet"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","retailSet:delete",new Date(),"retailSet"));

        //单号规则
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","orderRule:query",new Date(),"orderRule"));
        list.add(new Permission(UuidUtils.getUUID(),
                "修改","orderRule:insert",new Date(),"orderRule"));

        //初期信息
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","initInfo:query",new Date(),"initInfo"));

        //员工管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","user:query",new Date(),"user"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","user:insert",new Date(),"user"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","user:delete",new Date(),"user"));

        //角色管理
        list.add(new Permission(UuidUtils.getUUID(),
                "查询","role:query",new Date(),"role"));
        list.add(new Permission(UuidUtils.getUUID(),
                "新增","role:insert",new Date(),"role"));
        list.add(new Permission(UuidUtils.getUUID(),
                "删除","role:delete",new Date(),"role"));

        //企业资料
        list.add(new Permission(UuidUtils.getUUID(),
                "修改","company:insert",new Date(),"company"));

        permissionService.insertBatch(list);

    }
}
